package org.example.trackpackage.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.example.model.domain.TrackPackage;
import org.example.trackpackage.mapper.TrackPackageMapper;
import org.example.trackpackage.service.TrackPackageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TrackPackageServiceImpl implements TrackPackageService {
    @Autowired
    TrackPackageMapper trackPackageMapper;


    @Override
    public List<TrackPackage> findTrackPackage(Integer baoguoid) {
        List<TrackPackage> trackPackage = trackPackageMapper.findTrackPackage(baoguoid);
        int a=0;
        for (int i = 0; i < trackPackage.size(); i++) {
            if (trackPackage.get(i).getStatus() == 2) {
                a+=1;
                trackPackage.get(i).setNum(a);
                log.info("每" + (i + 1) + "次num{}", trackPackage.get(i).getNum());
            }
        }
        return trackPackage;
    }

    @Override
    public int updatecode(TrackPackage trackPackage) {
        return trackPackageMapper.updatecode(trackPackage);
    }
}
